package com.sven.player.utils;

/**
 * Created by Sven on 2016/10/14 0014.
 */

public class NumUtil {

    public  static int float2Int(float f) {
        int i;
        if (f > 0) //正数
            i = (int) ((f * 10 + 5) / 10);
        else if (f < 0) //负数
            i = (int) ((f * 10 - 5) / 10);
        else i = 0;
        return i;
    }

    public  static int long2Int(long l) {
        int i;
        if (l > 0) //正数
            i = (int) ((l * 10 + 5) / 1000);
        else if (l < 0) //负数
            i = (int) ((l * 10 - 5) / 1000);
        else i = 0;
        return i;
    }
}
